import App from './App'
import { createSSRApp } from 'vue'
import store from '@/store/store.js'
export function createApp() {
  const app = createSSRApp(App)
  app.use(store)
  return {
    app 
  }
}

import { $http } from '@escook/request-miniprogram'
//挂载
uni.$http=$http
//配置请求根路径
$http.baseUrl = 'https://www.uinav.com'
//请求拦截器
$http.beforeRequest = function (options) {
 uni.showLoading({
    title: '数据加载中...',
  })
  
  if(options.url.indexOf('/my')!==-1){
    options.header={
      // Authorization:store.state.m_user.token
      Authorization:'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOjIzLCJpYXQiOjE1NjQ3MzAwNzksImV4cCI6MTAwMTU2NDczMDA3OH0.YPt-XeLnjV-_1ITaXGY2FhxmCe4NvXuRnRB8OMCfnPo'
    }
  }
}
//响应拦截器
$http.afterRequest = function () {
uni.hideLoading()
}

uni.$showMsg=function(title='数据加载失败!',duration=1500){
  uni.showToast({
    title,
    duration,
    icon:'none'
  })
}

